Segmentation-based damage detection

ABSTRACT

A computer-implemented method includes: obtaining a sample picture and corresponding mark data, in which the mark data includes a first damage mark outline, and in which the first damage mark outline frames a damaged object in the sample picture; determining a segmentation type for a plurality of pixels in the sample picture based on the first damage mark outline, to generate segmentation mark data; inputting the sample picture to a weak segmentation damage detection model, in which the weak segmentation damage detection model includes an outline prediction branch and a segmentation prediction branch, in which the outline prediction branch outputs outline prediction data including a damage prediction outline, the damage prediction outline framing a predicted damaged object in the sample picture, and in which the segmentation prediction branch includes segmentation prediction data including a predicted segmentation type of each pixel of the plurality of pixels.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of claims the benefit of priority ofU.S. patent application Ser. No. 16/808,208, filed Mar. 3, 2020, whichis a continuation of PCT Application No. PCT/CN2020/072058, filed onJan. 14, 2020, which claims priority to Chinese Patent Application No.201910447785.X, filed on May 27, 2019, and each application is herebyincorporated by reference in their entirety.

TECHNICAL FIELD

One or more implementations of the present specification relate to thefield of machine learning, and in particular, to methods and apparatusesfor performing damage detection based on weak segmentation by usingmachine learning.

BACKGROUND

With rapid development of machine learning, various artificialintelligence technologies have been applied to a plurality of scenariosto help people alleviate technical problems in corresponding scenarios.Computer vision image recognition technologies have been applied to aplurality of scenarios in a plurality of fields, for example, medicalimage analysis.

Computer vision techniques have been attempted in the insurance industrybecause damage assessments require significant human efforts. However,conventional techniques are generally unsuitable to perform suchanalyses. For example, in a conventional vehicle insurance claimsscenario, an insurance company needs to designate a professionalsurveyor and a professional loss assessor to make a survey and assess aloss at an accident scene, provide a repair solution and a compensationamount for a vehicle, take a photo at the scene, and maintain the lossassessment photo for review by a reviewer at the back end. The insurancecompany needs to invest substantial manpower costs and expertisetraining costs due to manual survey and loss assessment. In terms ofexperience of a common user, the claims period lasts for one to threedays because the claims process involves taking a photo at the scene bythe surveyor, assessing a loss by the assessor at the repair place, andreviewing the loss by the reviewer at the back end. Consequently, theuser needs to wait for a long time, and user experience is poor. Forsuch industry disadvantages, it is desired that the image recognitiontechnologies can be used to automatically recognize, based on a damagepicture taken by a common user at a scene, a vehicle damage conditionreflected in the picture, and automatically provide a repair solution.In this case, no manual survey, loss assessment, and loss review areneeded, and therefore costs of the insurance company can be greatlyreduced, and vehicle insurance claims experience of the common user canbe improved.

In medical image analysis, it is also desired that image features can beintelligently analyzed based on a medical image by using the imagerecognition technologies, to help a doctor in diagnosis. In thesescenarios, a damaged object needs to be recognized from a picture(vehicle damage picture or medical image). However, conventionaltechniques are not suitable to be used in practice. Therefore, it isdesired to provide an improved solution to more accurately recognize adamaged object from a picture.

SUMMARY

One or more implementations of the present specification describe weaksegmentation-based damage detection methods and apparatuses, where aweak segmentation damage detection model is trained based onautomatically generated weak segmentation mark data, and a damage boxand a damage segmentation outline predicted and output by the model canbe used for mutual verification, thereby improving accuracy of damageprediction.

According to a first aspect, a computer-performed method for training aweak segmentation damage detection model is provided, and includes:obtaining a sample picture, where the sample picture has correspondingbox mark data, the box mark data indicates at least one damage mark box,and each damage mark box is a minimum rectangular box that is marked bya marker and frames a damaged object in the sample picture; using eachdamage mark box as an outline of a corresponding damaged object, andmarking a segmentation type for each pixel in the sample picture basedon the outline, to generate segmentation mark data; inputting the samplepicture to the weak segmentation damage detection model, where the weaksegmentation damage detection model includes a box prediction branch anda segmentation prediction branch, the box prediction branch outputs boxprediction data used to indicate a damage prediction box, and thesegmentation prediction branch outputs segmentation prediction dataobtained after the segmentation type of each pixel in the sample pictureis predicted; determining a box prediction loss term based on acomparison between the box prediction data and the box mark data, anddetermining a segmentation prediction loss term based on a comparisonbetween the segmentation prediction data and the segmentation mark data;determining a loss function for current prediction based on the boxprediction loss term and the segmentation prediction loss term; andupdating the weak segmentation damage detection model, to reduce theloss function.

In an implementation, a segmentation type is marked for each pixel byusing the following method: marking a first segmentation type for apixel located in the damage mark box, and marking a second segmentationtype for a pixel located outside the damage mark box.

In an implementation, the at least one damage mark box includes a firstdamage mark box, and the box mark data further includes a first damagetype that is in N predetermined damage types and is selected and markedby the marker for the first damage mark box; and in this case, themarking a segmentation type for each pixel includes: marking asegmentation type of a pixel located in the first damage mark box as atype corresponding to the first damage type.

In an implementation, the at least one damage mark box includes a firstdamage mark box and a second damage mark box, there is an overlappingregion between the first damage mark box and the second damage mark box,the box mark data further includes a first damage type that is in Npredetermined damage types and is selected and marked by the marker forthe first damage mark box and a second damage type that is in the Npredetermined damage types and is selected and marked by the marker forthe second damage type, and the second damage type corresponds to higherdamage severity than the first damage type; and in this case, themarking a segmentation type for each pixel includes: marking asegmentation type of a pixel located in the overlapping region as a typecorresponding to the second damage type.

In an implementation, the weak segmentation damage detection model isimplemented based on a convolutional neural network (CNN), the CNNincludes a basic convolution layer, configured to perform convolutionprocessing on the sample picture to obtain a corresponding convolutionalfeature map; the box prediction branch is used to predict the boxprediction data based on the convolutional feature map; and thesegmentation prediction branch is used to predict the segmentationprediction data based on the convolutional feature map.

Further, in an implementation, the segmentation prediction branch caninclude: an upsampling layer, configured to upsample a feature obtainedafter convolution processing into a first feature map that has the samesize as the sample picture; and a prediction processing layer,configured to predict, based on the first feature map, a probabilitythat each pixel belongs to each segmentation type.

In an implementation, the segmentation prediction data includes aprobability that each pixel belongs to each segmentation type; and inthis case, the segmentation prediction loss term can be determined asfollows: A predicted segmentation type of each pixel is determined basedon the probability that each pixel belongs to each segmentation type;and the predicted segmentation type of each pixel is compared with amarked segmentation type of the pixel, and the segmentation predictionloss term is determined based on a comparison result.

In another implementation, the segmentation prediction loss term can bedetermined as follows: A predicted probability that each pixel belongsto a marked segmentation type corresponding to the pixel is determined;and the segmentation prediction loss term is determined based on thepredicted probability.

According to a second aspect, a computer-performed method for detectingdamage from a picture is provided, and includes: obtaining a weaksegmentation damage detection model trained by using the methodaccording to the first aspect; inputting a to-be-examined picture to theweak segmentation damage detection model, where the weak segmentationdamage detection model includes a box prediction branch and asegmentation prediction branch, the box prediction branch outputs boxprediction data used to indicate at least one damage prediction box, andthe segmentation prediction branch outputs segmentation prediction dataobtained after a segmentation type of each pixel in the to-be-examinedpicture is predicted; and determining a damage detection result for theto-be-examined picture based on the box prediction data and thesegmentation prediction data.

In a case, the box prediction data may not indicate a damage predictionbox or the segmentation prediction data does not indicate a damagedobject region, where the damaged object region is a connected regionwhose area is greater than a specific threshold and that is formed by aset of pixels whose predicted segmentation types are the same damagetype. In this case, in an implementation, it can be determined that thedamage detection result is that the to-be-examined picture includes nodamaged object.

In another case, the box prediction data indicates at least one damageprediction box, and the segmentation prediction data indicates at leastone damaged object region. In this case, the damage detection result forthe to-be-examined picture can be determined based on the at least onedamage prediction box and the at least one damaged object region.

In a specific implementation, the determining the damage detectionresult for the to-be-examined picture can include: using a union set ofa region set corresponding to the at least one damage prediction box anda region set corresponding to the at least one damaged object region asthe damage detection result.

In another implementation, the determining the damage detection resultfor the to-be-examined picture can include: removing any first damageprediction box in the at least one damage prediction box from the damagedetection result if intersection-over-union between the first damageprediction box and each damaged object region is less than apredetermined threshold.

In still another implementation, the determining the damage detectionresult for the to-be-examined picture can include: removing any firstdamage prediction box in the at least one damage prediction box from thedamage detection result if a proportion of an intersection area betweenthe first damage prediction box and each damaged object region to a boxarea of the first damage prediction box is less than a predeterminedthreshold.

In an implementation, the at least one damage prediction box includes afirst damage prediction box, the box prediction data further includes afirst damage type predicted for the first damage prediction box, the atleast one damaged object region includes a first damaged object region,and a pixel in the first damaged object region corresponds to a firstsegmentation type. In this case, the determining the damage detectionresult for the to-be-examined picture can include: determining the firstdamage prediction box as an abnormal prediction box or determining thefirst damaged object region as an abnormal region ifintersection-over-union between the first damage prediction box and thefirst damaged object region is greater than a predetermined threshold,but the first damage type and the first segmentation type are notcorrelated.

According to a third aspect, an apparatus for training a weaksegmentation damage detection model is provided, and includes: a sampleacquisition unit, configured to obtain a sample picture, where thesample picture has corresponding box mark data, the box mark dataindicates at least one damage mark box, and each damage mark box is aminimum rectangular box that is marked by a marker and frames a damagedobject in the sample picture; a mark generation unit, configured to useeach damage mark box as an outline of a corresponding damaged object,and mark a segmentation type for each pixel in the sample picture basedon the outline, to generate segmentation mark data; a model input unit,configured to input the sample picture to the weak segmentation damagedetection model, where the weak segmentation damage detection modelincludes a box prediction branch and a segmentation prediction branch,the box prediction branch outputs box prediction data used to indicate adamage prediction box, and the segmentation prediction branch outputssegmentation prediction data obtained after the segmentation type ofeach pixel in the sample picture is predicted; a first determining unit,configured to determine a box prediction loss term based on a comparisonbetween the box prediction data and the box mark data, and determine asegmentation prediction loss term based on a comparison between thesegmentation prediction data and the segmentation mark data; a seconddetermining unit, configured to determine a loss function for currentprediction based on the box prediction loss term and the segmentationprediction loss term; and a model update unit, configured to update theweak segmentation damage detection model, to reduce the loss function.

According to a fourth aspect, an apparatus for detecting damage from apicture is provided, and includes: a model acquisition unit, configuredto obtain a weak segmentation damage detection model trained by usingthe apparatus in the third aspect; a model input unit, configured toinput a to-be-examined picture to the weak segmentation damage detectionmodel, where the weak segmentation damage detection model includes a boxprediction branch and a segmentation prediction branch, the boxprediction branch outputs box prediction data used to indicate at leastone damage prediction box, and the segmentation prediction branchoutputs segmentation prediction data obtained after a segmentation typeof each pixel in the to-be-examined picture is predicted; and a resultdetermining unit, configured to determine a damage detection result forthe to-be-examined picture based on the box prediction data and thesegmentation prediction data.

According to a fifth aspect, a computer readable storage medium isprovided, where the computer readable storage medium stores a computerprogram, and when the computer program is executed in a computer, thecomputer is enabled to perform the methods in the first aspect and thesecond aspect.

According to a sixth aspect, a computing device is provided, andincludes a memory and a processor, where the memory stores executablecode, and when the processor executes the executable code, the methodsin the first aspect and the second aspect are implemented.

According to the method and apparatus provided in the implementations ofthe present specification, the weak segmentation mark data is generatedbased on the damage box obtained through manual marking, the weaksegmentation mark data is used to train the weak segmentation damagedetection model that includes the box prediction branch and thesegmentation prediction branch, and when in use, the to-be-examinedpicture is input to the weak segmentation damage detection model, toobtain the damage prediction box and the damaged object region by usingthe two branches. The damage prediction box and the damaged objectregion can be used for mutual verification and supplementation, therebyimproving accuracy of damage detection.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the implementations of thepresent disclosure more clearly, the following briefly describes theaccompanying drawings needed for describing the implementations.Clearly, the accompanying drawings in the following description showmerely some implementations of the present disclosure, and a person ofordinary skill in the art can further derive other drawings from theseaccompanying drawings without creative efforts.

FIG. 1 is a schematic diagram illustrating an implementation scenario,according to an implementation;

FIG. 2 is a flowchart illustrating a method for training a weaksegmentation damage detection model, according to an implementation;

FIG. 3 illustrates a specific example of a manually marked samplepicture;

FIG. 4 is a schematic diagram illustrating marking a segmentation typefor a pixel, according to an implementation;

FIG. 5 is a schematic structural diagram of a weak segmentation damagedetection model, according to an implementation;

FIG. 6 is a flowchart illustrating steps of a method for recognizingdamage from a picture, according to an implementation;

FIG. 7 illustrates a damage prediction box and a damaged object regionoutput by a weak segmentation damage detection model in an example;

FIG. 8 is a schematic block diagram illustrating an apparatus fortraining a weak segmentation damage detection model, according to animplementation; and

FIG. 9 is a schematic block diagram illustrating a damage detectionapparatus, according to an implementation.

DESCRIPTION OF IMPLEMENTATIONS

The following describes the solutions provided in the presentspecification with reference to the accompanying drawings.

As described above, in a plurality of scenarios such as intelligentvehicle loss assessment and medical image analysis, a damaged object,for example, vehicle damage or an organ lesion, needs to be recognizedfrom a picture. Therefore, a damage detection model that uses a damagedobject as a detection target can be trained to perform damagerecognition by using the damage detection model. A large amount of markdata is usually needed to train the model. For damage detection, amarker can mark a damaged object as a specific target object, that is,mark the damaged object in a picture by using a minimum rectangular boxthat includes the damaged object. Such a rectangular box is alsoreferred to as a damage mark box. An original sample and the damage markbox jointly constitute a picture training sample. The damage detectionmodel can be obtained by training the model by using such as trainingsample. After the damage detection model is obtained through training,damage recognition can be performed on a to-be-examined picture by usingthe damage detection model. An output result of the damage detectionmodel is usually several damage prediction boxes predicted in theto-be-examined picture. Each damage prediction box frames a predicteddamaged object by using a minimum rectangular box.

However, as described above, currently, detection accuracy of the damagedetection model needs to be improved. Especially, in a vehicle damagerecognition scenario, a vehicle damage picture is taken in a relativelycomplex environment, and is usually affected by factors such asreflection and stains. Consequently, accuracy of damage detection is notideal. For example, reflection and stains are incorrectly detected asdamage.

Therefore, the inventor proposes to perform image segmentation on ato-be-examined picture in addition to conventional damage detection, andverify or supplement a conventional damage detection result by using asegmentation result.

Image segmentation is also referred to as image semantic segmentation,and is used to segment or divide an image into regions that belong to/donot belong to a specific target object. An output of the imagesegmentation can be represented as a mask that covers a specific targetobject region. An image segmentation model is usually trained based onsegmentation mark data for marking an outline of a target object. In adamage recognition scenario, the image segmentation is used to divide apicture into regions that belong to/do not belong to a damaged object.Correspondingly, it can be understood that the mark data for marking anoutline of a damaged object is needed to train the model.

Marking of an outline usually requires the marker to draw a boundary ofa target object by using several mark points. This process istime-consuming and costly. Especially, it is very costly forpoorly-defined target objects in an irregular shape.

In consideration of the previous factors, according to theimplementations of the present disclosure, image segmentation trainingis performed by using a damage mark box as a mark for a general outlineof a damaged object, to obtain a damage detection model that includestwo branches, where one branch performs conventional damaged objectdetection, and the other branch performs image segmentation.Segmentation mark data is automatically generated by directly using thedamage mark box as the outline of the damaged object, and has limitedprecision. Therefore, a model trained by using this method can bereferred to as a weak segmentation damage detection model. The weaksegmentation damage detection model can output a conventional damageprediction box and a weak segmentation result. The two results can becombined to optimize a final damage detection result.

FIG. 1 is a schematic diagram illustrating an implementation scenario,according to an implementation. As shown in FIG. 1, a training sample isused in advance to train a weak segmentation damage detection model.Specifically, the training sample includes a sample picture and markdata. The mark data for segmentation training is automatically generatedby directly using a damage mark box as an outline of a damaged object. Adamage detection model that includes two branches in FIG. 1 can beobtained through training by using such a training sample. One branch isa detection branch, and is used to perform conventional damagedetection, and the other branch is a segmentation branch, and is used toperform image weak segmentation.

After the weak segmentation damage detection model is obtained throughtraining, damage detection can be performed by using the model. As shownin FIG. 1, a to-be-examined picture can be input to the damage detectionmodel. In the model, feature extraction is first performed on theto-be-examined picture, and then the detection branch outputs a damageprediction box for the to-be-examined picture, and the segmentationbranch outputs a damage segmentation region for the to-be-examinedpicture. A final damage detection result can be obtained by combininganalysis of the damage prediction box and the damage segmentationregion.

The following describes a training process of the weak segmentationdamage detection model and a prediction process of performing damagedetection by using the model.

FIG. 2 is a flowchart illustrating a method for training a weaksegmentation damage detection model, according to an implementation. Itcan be understood that the method can be performed by any apparatus,device, platform, or device cluster with computing and processingcapabilities. As shown in FIG. 2, the training process includes at leastthe following steps: Step 21: Obtain a sample picture, where the samplepicture has corresponding box mark data that indicates a damage markbox. Step 22: Use each damage mark box as an outline of a correspondingdamaged object, and mark a segmentation type for each pixel in thesample picture based on the outline, to generate segmentation mark data.Step 23: Input the sample picture to the weak segmentation damagedetection model, where the model includes a box prediction branch and asegmentation prediction branch, the box prediction branch outputs damageprediction data that indicates a damage prediction box, and thesegmentation prediction branch predicts the segmentation type of eachpixel, to output segmentation prediction data. Step 24: Determine a boxprediction loss term based on a comparison between the damage predictiondata and the box mark data, and determine a segmentation prediction lossterm based on a comparison between the segmentation prediction data andthe segmentation mark data. Step 25: Determine a loss function forcurrent prediction based on the box prediction loss term and thesegmentation prediction loss term. Step 26: Update the damage detectionmodel, to reduce the loss function. The following describes specificimplementations of the steps.

First, in step 21, the manually marked sample picture is obtained. Thesample picture is usually a picture that includes a damaged object, forexample, a picture of a damaged vehicle that is taken at a vehicledamage scene. Such a sample picture is marked by a marker, and hascorresponding mark data. For marking of a damage detection task, themarker can frame a damaged object in the picture by using a minimumrectangular box that includes the damaged object. Such a minimumrectangular box is referred to as the damage mark box. Therefore, thedata for manually marking the sample picture is also referred to as thebox mark data that can indicate each damage mark box.

FIG. 3 illustrates a specific example of a manually marked samplepicture. In the example in FIG. 3, the sample picture is a picture of adamaged vehicle. After manual marking, the marker frames several damagedobjects in the picture by using rectangular boxes, in other words, markseveral damage mark boxes.

In an implementation, the marker can mark only a location of the damagedobject, that is, frame the damaged object by using the damage mark boxwithout distinguishing between damage types.

In another implementation, the marker can mark a type of each damagedobject from N predetermined damage types. For example, for vehicledamage, N=10 damage types can be preset, for example, including scratch,deformation, crack, and (glass) break. In this case, in addition to thedamage mark box, the marker can mark and select a type corresponding tothe vehicle damage from the 10 damage types.

In FIG. 3, a number in the upper right corner of the damage mark boxshows a damage type of a damaged object in the damage mark box. Forexample, 12 corresponds to scratch, and 10 corresponds to deformation.It can be understood that the damage type can be marked by using aplurality of methods. Different from the method in which differentdamage types are represented by using different numbers in FIG. 3, amethod in which different damage types are represented by using markboxes in different colors can be used. FIG. 3 is merely an example.

After the sample picture and the box mark data corresponding to thepicture are obtained, in step 22, the segmentation mark data isautomatically generated based on the box mark data.

As described above, the segmentation mark data is data for marking anoutline of a target object to perform image segmentation training. In aconventional technology, the segmentation mark data is obtained based onthe outline of the target object that is drawn by the marker by usingseveral mark points. Typically, the segmentation mark data is apixel-level mark, that is, whether each pixel in the picture belongs toa specific target object is marked.

To reduce marking costs, in step 22, each damage mark box is directlyused as the outline of the corresponding damaged object, and thesegmentation type is marked for each pixel in the sample picture basedon the outline, to automatically generate the segmentation mark data.

More specifically, in an implementation, the damage mark box is used asan outline of a damaged object, and whether each pixel belongs to thedamaged object is determined based on information whether the pixelfalls within the damage mark box, to mark the segmentation type for thepixel. For example, a first segmentation type is marked for a pixellocated in the damage mark box, and a second segmentation type is markedfor a pixel located outside the damage mark box. In this method, pixelsin the sample picture are classified into two types: a foreground partthat belongs to the damaged object (corresponding to the firstsegmentation type) and a background part that does not belong to thedamaged object (corresponding to the second segmentation type).

In an implementation, as described above, the box mark data furtherincludes a damage type marked by the marker for each damage mark box,for example, a damage type 12 corresponding to scratch in FIG. 3 and adamage type 10 corresponding to deformation. In this case, in animplementation, a segmentation type is marked for a pixel based on adamage type of a damage mark box that the pixel falls within.Specifically, for ease of description, any damage mark box is referredto as a first damage mark box. Assume that a first damage type is markedfor the first damage mark box. Therefore, in step 22, a segmentationtype of a pixel that falls within the first damage mark box is marked asa type corresponding to the first damage type.

In this case, if N damage types are preset, pixels can be classifiedinto N+1 segmentation types during segmentation marking. The first Nsegmentation types are in a one-to-one mapping relationship with the Ndamage types, and the other one segmentation type corresponds to a casein which a pixel does not belong to any damage mark box. Morespecifically, for vehicle damage, if 10 damage types are preset for thedamaged object, when a segmentation type is marked for a pixel, thesegmentation type can be marked for the pixel based on a type that is inthe 10 damage types and is of a damage mark box that the pixel fallswithin. If the pixel does not fall within any damage mark box, thesegmentation type of the pixel is marked as an eleventh type.

In an implementation, damage mark boxes overlap. In this case, asegmentation type can be marked for a pixel that falls within anoverlapping region between a plurality of damage mark boxes based onranks of severity of damage types corresponding to the plurality ofdamage mark boxes.

Usually, if N damage types are set, ranks of damage severitycorresponding to the damage types can be further preset. For example, inthe case of vehicle damage, it can be set that severity of damage typesis ranked in ascending order, including scratch<deformation<crack. In animplementation, when a pixel falls within an overlapping region betweena plurality of damage mark boxes, a damage type with the higher damageseverity can be determined from damage types corresponding to theplurality of damage mark boxes based on ranks of severity of the damagetypes, and a type corresponding to the damage type is used as asegmentation type of the pixel.

FIG. 4 is a schematic diagram illustrating marking a segmentation typefor a pixel, according to an implementation. FIG. 4 shows three damagemark boxes A, B, and C, which are respectively marked with damage typesa, b, and c. A segmentation type of each pixel (a pixel in a shadedregion) included in the damage mark box A can be marked as a typecorresponding to the damage type a.

There is an overlapping region between the damage mark boxes B and C.Assume that the damage type b corresponds to higher severity than thedamage type c. In this case, a type corresponding to the damage type bcan be marked for a pixel in the overlapping region. Types correspondingto the damage types b and c are marked for pixels located outside theoverlapping region between the damage mark boxes B and C. In this case,the type b is marked for a pixel in an oblique line region, and the typec is marked for a pixel in a square region.

A segmentation type of another pixel that does not fall within anydamage mark box can be marked as a type 0.

As such, in the previous method, the damage mark box is used as theoutline of the corresponding damaged object, and the segmentation typeis marked for each pixel, to automatically generate the segmentationmark data.

It can be understood that the damage mark box is a minimum rectangularbox that frames the damaged object, and is usually not equal to a realoutline of the damaged object. The damage mark box is used as theoutline of the damaged object to perform segmentation marking, which ismerely rough approximation marking. Therefore, the mark data can also bereferred to as weak segmentation mark data. Such weak segmentation markdata can be used to train the weak segmentation damage detection model.

Referring back to FIG. 2, in step 23, the sample picture is input to theweak segmentation damage detection model, and the weak segmentationdamage detection model predicts the damaged object in the samplepicture. It should be understood that the weak segmentation damagedetection model here can be an initial model, or can be a model thatneeds to be further updated in the training process. Specifically, theweak segmentation damage detection model includes two branches: the boxprediction branch and the segmentation prediction branch. The boxprediction branch outputs the damage prediction box predicted for thesample picture, and the segmentation prediction branch predicts thesegmentation type of each pixel to generate the segmentation predictiondata.

The weak segmentation damage detection model can be implemented based onvarious algorithms and model structures. Typically, the weaksegmentation damage detection model can be implemented based on aconvolutional neural network (CNN).

FIG. 5 is a schematic structural diagram of a weak segmentation damagedetection model, according to an implementation. In the example, theweak segmentation damage detection model is implemented as aconvolutional neural network (CNN). As shown in FIG. 5, the neuralnetwork includes a basic convolution layer 510, a box prediction branch520, and a segmentation prediction branch 530.

The basic convolution layer 510 is configured to perform convolutionprocessing on the input sample picture to obtain a convolutional featuremap. The basic convolution layer 510 usually can include a plurality ofsublayers, and convolution processing is performed at each sublayer byusing a corresponding convolutional check picture. After the convolutionprocessing at the sublayer, optionally, pooling processing can befurther performed. The convolution processing and pooling processing areperformed for a plurality of times, so that the obtained feature map canreflect more abstract and higher-order features in the original samplepicture. Usually, based on a size of a convolution kernel and thequantity of times convolution processing is performed, the feature mapobtained after convolution processing is smaller than the originalsample picture in dimension.

The box prediction branch 520 performs box prediction based on theconvolutional feature map, and outputs the box prediction data. The boxprediction data indicates the predicted damage prediction box. When thetraining data further includes the damage type marked for each damagemark box, the box prediction branch further predicts the damage typecorresponding to each damage prediction box. The box prediction branchcan be implemented by using various known target detection algorithms,or in terms of structure, can be implemented by using various knownneural network structures used to perform target detection. For example,the box prediction branch can further include a convolution processinglayer, a box regression layer, and a fully connected processing layer.

The segmentation prediction branch 530 predicts the segmentation type ofthe pixel based on the convolutional feature map, to obtain thesegmentation prediction data.

Specifically, the segmentation prediction branch 530 can include asegmentation convolution layer 531, configured to perform furtherconvolution processing on the convolutional feature map. A convolutionkernel in the segmentation convolution layer 531 can be designed forfeatures of segmentation prediction, and is different from a convolutionkernel in the basic convolution layer. Therefore, features obtainedafter further convolution processing is performed are more favorable tosubsequent segmentation prediction processing. However, it should beunderstood that the convolution layer 531 is an optional networkprocessing layer, and the network processing layer can be omitted insome cases.

The segmentation prediction branch 530 further includes an upsamplinglayer 532, configured to upsample a feature obtained after convolutionprocessing into a first feature map that has the same size as the samplepicture. As described above, the feature map obtained after convolutionprocessing is smaller than the original sample picture in dimension.Therefore, in the segmentation prediction branch, a feature map that hasthe same size as the original picture is restored by using theupsampling layer. Specifically, the upsampling layer 532 can restore, byusing an upsampling method such as interpolation processing, the featurewith a small dimension obtained after convolution processing into thefirst feature map that is the same as the original sample picture indimension. Therefore, each pixel in the first feature map corresponds toeach pixel in the original sample picture.

Then, the segmentation processing layer 533 predicts a probability thateach pixel in the first feature map belongs to each segmentation type.The pixels in the first feature map respectively correspond to thepixels in the original sample picture. Therefore, that the segmentationprocessing layer 533 predicts a segmentation type of the pixel in thefirst feature map is equivalent to predicting a probability that eachpixel in the sample picture belongs to each segmentation type.

Specifically, in a case of two classifications, the segmentationprocessing layer 533 can predict a probability that each pixel belongsto the damaged object (corresponding to a first segmentation type). Inan implementation, it can be determined that a pixel whose probabilityvalue is greater than a predetermined threshold belongs to the damagedobject.

In a case of a plurality of classifications, for example, when there areN+1 segmentation types, the segmentation processing layer 533 canpredict a probability P_(ij) that each pixel i belongs to the jthsegmentation type in the N+1 segmentation types. Therefore, a vector(P_(i0), P_(i1), P_(i2), . . . , P_(iN)) of probabilities that eachpixel i belongs to all the segmentation types can be formed.Alternatively, a set of probabilities that all the pixels belong to eachsegmentation type j can be formed. The pixels in the picture are usuallyarranged in a matrix form, and therefore the probability set for eachsegmentation type j can be formed as a probability matrix correspondingto the pixels.

The segmentation prediction branch 530 can at least output, by using theupsampling layer 532 and the segmentation processing layer 533, thesegmentation prediction data obtained after the segmentation type ofeach pixel is predicted. In an implementation, the segmentationprediction data is the probability that the pixel belongs to eachsegmentation type and is predicted by the segmentation processing layer533. In another implementation, the segmentation prediction branch candetermine a predicted segmentation type of each pixel based on theprobability, and use the segmentation type as the segmentationprediction data. For example, a segmentation type with the highestpredicted probability is used as the predicted segmentation type of eachpixel.

Therefore, the box prediction data and the segmentation prediction dataare obtained by using the weak segmentation damage detection model shownin FIG. 5.

It is worthwhile to note that the segmentation mark data used forsegmentation training is automatically generated based on the damagemark box, and therefore is different from conventional segmentation markdata. In addition, a model structure of the weak segmentation damagedetection model is also different from that of a conventional damagedetection model. The conventional damage detection model does notinclude a segmentation branch, and therefore is not used for imagesegmentation. A conventional image segmentation model does not include abox prediction branch, and therefore is not used for box prediction.Although there are some neural network models that are used to performboth box prediction and image segmentation, for example, Mask-RCNN, suchmodels are usually divided into two branches after alternative damageboxes are selected. One branch performs further regression and typeprediction on the alternative damage box, and the other branch performsimage segmentation based on the alternative damage box, that is, imagesegmentation is performed in the alternative damage box. In other words,in models such as Mask-RCNN, image segmentation is performed based onbox prediction, and is not a branch independent of the box predictionbranch.

In the weak segmentation damage detection model shown in FIG. 5, afterbasic convolution processing is performed by using the basic convolutionlayer, the model is divided into two independent branches. The boxprediction branch and the segmentation prediction branch perform furtherprocessing and prediction based on the feature map obtained afterconvolution processing, and the prediction processes are independent ofeach other. The two branches perform prediction independently, so thatprediction results output by the two branches are more favorable tomutual verification.

In practice, the weak segmentation damage detection model can beobtained through modification based on a plurality of specific CNNnetwork structures. For example, a recurrent fully convolutional network(RFCN) can be used as a basic network structure, and the segmentationprediction branch is added after the feature map and beforeposition-sensitive convolution.

In this method, the weak segmentation damage detection model thatincludes two branches is implemented by using a plurality of specificneural network structures. In the model, the box prediction branchgenerates the box prediction data related to the damage prediction box,and the segmentation prediction branch generates the segmentationprediction data related to the segmentation type of each pixel.

To train such a model, next, the prediction data needs to be comparedwith the corresponding mark data, to obtain a value of the loss functionfor the current prediction, which serves as a basis for update andadjustment of a parameter in the model.

Specifically, referring back to FIG. 2, in step 24, the box predictionloss term is determined based on the comparison between the boxprediction data and the box mark data. In an implementation, the boxprediction data indicates a location of each predicted damage predictionbox. The box prediction loss term can be determined by comparing alocation difference between the damage prediction box and the damagemark box. In an implementation, the box prediction data furtherindicates a predicted damage type corresponding to each damageprediction box. In this case, based on the location difference, apredicted damage type of the damage prediction box is further comparedwith a marked damage type of the corresponding damage mark box, and thebox prediction loss term is determined based on the comparison betweentypes. In mathematics, the box prediction loss term can be determined byusing various conventional algorithms. For example, an L2 error form isused as the box prediction loss term.

In step 24, the segmentation prediction loss term is further determinedbased on the comparison between the segmentation prediction data and thesegmentation mark data.

In an implementation, the segmentation prediction loss term isdetermined based on a comparison between segmentation types.Specifically, in an implementation, the segmentation prediction branchoutputs the probability that each pixel belongs to each segmentationtype as the segmentation prediction data. In this case, the predictedsegmentation type of each pixel can be determined based on theprobability. For example, a segmentation type with the highestprobability is used as the predicted segmentation type corresponding tothe pixel. In another implementation, the segmentation prediction branchdirectly outputs the predicted segmentation type of each pixel. In thiscase, the predicted segmentation type can be directly obtained from thesegmentation prediction data. Then, the predicted segmentation type ofeach pixel is compared with a marked segmentation type of the pixel, andpixels whose predicted segmentation types are consistent with markedsegmentation types are counted, in other words, the quantity of pixelsfor which prediction is correct or a proportion of the quantity to thetotal quantity of pixels is obtained. The segmentation prediction lossterm is determined based on the quantity or the proportion, and a largerquantity or a larger proportion indicates a smaller segmentationprediction loss term.

In another implementation, the segmentation prediction loss term isdetermined based on the probability that each pixel belongs to eachsegmentation type in the segmentation prediction data and a markedsegmentation type of each pixel. Specifically, the vector (P_(i0),P_(i1), P_(i2), . . . , P_(iN)) of probabilities that each pixel ibelongs to all the segmentation types can be obtained from thesegmentation prediction data. In addition, the marked segmentation typek of the pixel i is obtained. Therefore, a segmentation loss termcorresponding to the pixel i can be determined as:

${L_{i} = {{\sum\limits_{j \neq k}P_{ij}^{2}} + ( {1 - P_{ik}} )^{2}}},$

whereP_(ij) represents the probability that the pixel i belongs to thesegmentation type j, and the segmentation type k is a markedsegmentation type. Then, segmentation loss terms of all the pixels i canbe added to obtain the segmentation loss term for the currentprediction.

In another implementation, by using a softmax function based on thepredicted probability that each pixel belongs to each segmentation typeand a marked segmentation type of the pixel, the segmentation loss termL can be determined as:

p = softmax(pred)$L = {- {\sum\limits_{i}{\sum\limits_{j}{{label}_{j}\mspace{14mu} \log \mspace{14mu} {p_{ij}.}}}}}$

In still another implementation, the segmentation prediction loss termis determined based on the predicted probability that each pixelcorresponds to a marked segmentation type. Specifically, a markedsegmentation type k of any pixel i is obtained from the segmentationmark data. In addition, the vector (P_(i0), P_(i1), P_(i2), . . .P_(iN)) of probabilities that the pixel i belongs to all thesegmentation types is obtained from the segmentation prediction data,and the predicted probability P_(ik) corresponding to the markedsegmentation type k is extracted from the vector. The segmentationprediction loss term can be determined based on the predictedprobability that each pixel corresponds to the marked segmentation type.In an example, the segmentation prediction loss term can be expressedas:

${L = {\sum\limits_{i}( {1 - P_{i}} )^{2}}},$

wherePi represents the predicted probability that the pixel i belongs to themarked segmentation type of the pixel i.

In another implementation, the segmentation prediction loss term can bedetermined based on the probability that each pixel belongs to eachsegmentation type by using another function form, cross entropy, etc.

Next, in step 25, the loss function for the current prediction isdetermined based on the box prediction loss term and the segmentationprediction loss term determined in step 24. In an implementation, thesum of the box prediction loss term and the segmentation prediction lossterm can be determined as the loss function for the current prediction.In another implementation, weighted summation can be performed on thebox prediction loss term and the segmentation prediction loss term, toobtain the loss function for the current prediction.

Then, in step 26, the weak segmentation damage detection model isupdated, to reduce the loss function. In other words, model parametersof the weak segmentation damage detection model are adjusted, toconstantly reduce the loss function. The parameter adjustment processcan be performed by using conventional methods such as back propagationand gradient descent.

In the previous process, the model parameters are constantly updateduntil a predetermined convergence condition is satisfied, or a modeltest result satisfies a specific accuracy condition. In this case,training of the model is completed, and the trained weak segmentationdamage detection model is obtained. The model is trained based on theautomatically generated weak segmentation mark data, and achieves strongprediction of the damage box and weak prediction of the damage outlineby using the two independent branches.

The following describes a process of performing damage prediction byusing the trained weak segmentation damage detection model.

FIG. 6 is a flowchart illustrating steps of a method for recognizingdamage from a picture, according to an implementation. As shown in FIG.6, the process includes the following steps.

In step 61, a weak segmentation damage detection model trained by usingthe method in FIG. 2 is obtained. The model includes a box predictionbranch and a segmentation prediction branch. The weak segmentationdamage detection model has, for example, the structure shown in FIG. 5.

In step 62, a to-be-examined picture is input to the weak segmentationdamage detection model. Therefore, the box prediction branch in themodel outputs box prediction data used to indicate a damage predictionbox, and the segmentation prediction branch outputs segmentationprediction data obtained after a segmentation type of each pixel in theto-be-examined picture is predicted. A process of outputting the boxprediction data and the segmentation prediction data by using the twobranches is similar to that in step 23 in the previous training process,and is omitted here for simplicity.

Next, in step 63, a damage detection result for the to-be-examinedpicture is determined based on the box prediction data and thesegmentation prediction data.

Therefore, in an implementation, a damaged object region, namely, aconnected region whose area is greater than a specific threshold andthat is formed by a set of pixels whose predicted segmentation types arethe same damage type, is first determined based on the segmentationprediction data.

Specifically, in an example, the segmentation prediction data includes apredicted segmentation type corresponding to each pixel in theto-be-examined picture. In another example, the segmentation predictiondata includes a probability that each pixel in the to-be-examinedpicture belongs to each segmentation type. In this case, the predictedsegmentation type of each pixel can be determined based on theprobability.

The damaged object region can be obtained based on the predictedsegmentation type of each pixel. Specifically, a set of pixels whosepredicted segmentation types are the same damage type can be firstobtained, and whether the set forms a connected region and whether anarea of the connected region is greater than the specific threshold canbe determined. If the set of pixels with the same damage type can form aconnected region whose area is greater than the specific threshold, theconnected region is used as a damaged object region.

In a case, the box prediction data indicates at least one damageprediction box, but the damaged object region cannot be obtained fromthe segmentation prediction data. Alternatively, at least one damagedobject region is obtained from the segmentation prediction data, but thebox prediction data does not indicate a damage prediction box. In animplementation, in the previous two cases, in step 63, it is determinedthat the to-be-examined picture includes no damaged object.

In another case, the box prediction data indicates at least one damageprediction box, and at least one damaged object region is obtained fromthe segmentation prediction data. In this case, in step 63, the damagedetection result for the to-be-examined picture is determined based onthe at least one damage prediction box and the at least one damagedobject region.

In an implementation, a union set of a region set corresponding to theat least one damage prediction box and a region set corresponding to theat least one damaged object region is used as the damage detectionresult. The damage detection result obtained in this methodcomprehensively includes possible damage, and detection omission can beavoided to the largest extent.

In an implementation, an abnormal damage prediction box is removed fromthe damage detection result based on overlapping between the damageprediction box and the damaged object region. The following providesdescription by using an example in which any damage prediction box isreferred to as a first damage prediction box.

In an implementation, intersection-over-union (IoU), namely, a ratio ofan intersection area to a union area, between the first damageprediction box and each damaged object region can be calculated. If eachcalculated IoU is less than a predetermined threshold, it indicates thatthe first damage prediction box slightly overlaps each damaged objectregion. In other words, there is no damaged object region that can beused to verify the first damage prediction box. Therefore, the firstdamage prediction box is removed from the damage detection result.

In another implementation, a proportion of an intersection area betweenthe first damage prediction box and each damaged object region to a boxarea of the first damage prediction box is calculated. If the calculatedproportion is less than a predetermined threshold, the first damageprediction box is removed from the damage detection result.

In an implementation, a size of an overlapping region between the damageprediction box and the damaged object region is verified, and types arealso verified. In such an implementation, the box prediction data needsto further include a damage type predicted for each damage predictionbox. Assume that the first damage prediction box corresponds to apredicted first damage type in the box prediction data. In addition,assume that each pixel in any first damaged object region in the atleast one damaged object region corresponds to a first segmentationtype.

In an implementation, IoU between the first damage prediction box andthe first damaged object region is first determined. If the IoU isgreater than a predetermined threshold, that is, an overlapping rate ofthe first damage prediction box and the first damaged object region islarge enough, whether the first damage type and the first segmentationtype are correlated is determined. If the first damage type and thefirst segmentation type are correlated, the first damage prediction boxand the first damaged object region can be used for mutual verification.If the first damage type and the first segmentation type are notcorrelated, for example, the first damage type indicates scratch and thefirst segmentation type indicates glass break, it indicates that atleast one of the first damage prediction box and the first damagedobject region is abnormal. In this case, the first damage prediction boxcan be determined as an abnormal prediction box, or the first damagedobject region can be determined as an abnormal region for furtherdetection and confirmation. As such, an abnormal result obtained due tofalse detection is further removed from the damage detection result.

FIG. 7 illustrates a damage prediction box and a damaged object regionoutput by a weak segmentation damage detection model in an example. Inthe example in FIG. 7, a to-be-examined picture is a vehicle damagepicture. A plurality of damage prediction boxes are predicted in theto-be-examined picture, and two numbers marked in the upper left cornerof each damage prediction box respectively show a predicted damage typeand a prediction confidence level. A damaged object region is generatedbased on a predicted segmentation type of each pixel, and is shown byusing a mask. In practice, when there are a plurality of damage types,damaged object regions corresponding to different segmentation types canbe shown by using masks in different colors. The damage prediction boxand the damaged object region shown in FIG. 7 can be comprehensivelyanalyzed by using the previous various methods, to obtain a damagedetection result.

In the previous process, the weak segmentation damage detection modelthat includes two branches is obtained through training by using the boxmark data obtained through manual marking and the automaticallygenerated weak segmentation mark data. The box prediction branch and thesegmentation prediction branch respectively and independently performbox prediction and segmentation prediction. The segmentation mark datais a weak mark, and therefore has low precision. Corresponding, aprediction result of the segmentation prediction branch is usually notaccurate, and cannot be used as an independent outline result of adamaged object. However, the weak segmentation prediction result can beused in combination with a box prediction result, and is used with thedamage prediction box for mutual verification to find detection omissionand false detection, to optimize and improve a damage detection resultand improve detection accuracy.

According to an implementation of another aspect, an apparatus fortraining a weak segmentation damage detection model is provided. Theapparatus can be deployed in any device, platform, or device clusterwith computing and processing capabilities. FIG. 8 is a schematic blockdiagram illustrating an apparatus for training a weak segmentationdamage detection model, according to an implementation. As shown in FIG.8, the training apparatus 800 includes: a sample acquisition unit 81,configured to obtain a sample picture, where the sample picture hascorresponding box mark data, the box mark data indicates at least onedamage mark box, and each damage mark box is a minimum rectangular boxthat is marked by a marker and frames a damaged object in the samplepicture; a mark generation unit 82, configured to use each damage markbox as an outline of a corresponding damaged object, and mark asegmentation type for each pixel in the sample picture based on theoutline, to generate segmentation mark data; a model input unit 83,configured to input the sample picture to the weak segmentation damagedetection model, where the weak segmentation damage detection modelincludes a box prediction branch and a segmentation prediction branch,the box prediction branch outputs box prediction data used to indicate adamage prediction box, and the segmentation prediction branch outputssegmentation prediction data obtained after the segmentation type ofeach pixel in the sample picture is predicted; a first determining unit84, configured to determine a box prediction loss term based on acomparison between the box prediction data and the box mark data, anddetermine a segmentation prediction loss term based on a comparisonbetween the segmentation prediction data and the segmentation mark data;a second determining unit 85, configured to determine a loss functionfor current prediction based on the box prediction loss term and thesegmentation prediction loss term; and a model update unit 86,configured to update the weak segmentation damage detection model, toreduce the loss function.

In an implementation, the mark generation unit 82 is configured to: marka first segmentation type for a pixel located in the damage mark box,and mark a second segmentation type for a pixel located outside thedamage mark box.

In an implementation, the at least one damage mark box includes a firstdamage mark box, and the box mark data further includes a first damagetype that is in N predetermined damage types and is selected and markedby the marker for the first damage mark box. In this case, the markgeneration unit 82 can be configured to mark a segmentation type of apixel located in the first damage mark box as a type corresponding tothe first damage type.

In an implementation, the at least one damage mark box includes a firstdamage mark box and a second damage mark box, there is an overlappingregion between the first damage mark box and the second damage mark box,the box mark data further includes a first damage type that is in Npredetermined damage types and is selected and marked by the marker forthe first damage mark box and a second damage type that is in the Npredetermined damage types and is selected and marked by the marker forthe second damage type, and the second damage type corresponds to higherdamage severity than the first damage type. In this case, the markgeneration unit 82 can be configured to mark a segmentation type of apixel located in the overlapping region as a type corresponding to thesecond damage type.

In an implementation, the weak segmentation damage detection model canbe implemented based on a convolutional neural network (CNN), the CNNincludes a basic convolution layer, configured to perform convolutionprocessing on the sample picture to obtain a corresponding convolutionalfeature map. Correspondingly, the box prediction branch can predict thebox prediction data based on the convolutional feature map, and thesegmentation prediction branch can predict the segmentation predictiondata based on the convolutional feature map.

Further, in an implementation, the segmentation prediction branch caninclude: an upsampling layer, configured to upsample a feature obtainedafter convolution processing into a first feature map that has the samesize as the sample picture; and a prediction processing layer,configured to predict, based on the first feature map, a probabilitythat each pixel belongs to each segmentation type.

In an implementation, the segmentation prediction data includes aprobability that each pixel belongs to each segmentation type, and thefirst determining unit 84 is configured to: determine a predictedsegmentation type of each pixel based on the probability that each pixelbelongs to each segmentation type; and compare the predictedsegmentation type of each pixel with a marked segmentation type of thepixel, and determine the segmentation prediction loss term based on acomparison result.

In another implementation, the first determining unit 84 is configuredto: determine a predicted probability that each pixel belongs to amarked segmentation type corresponding to the pixel; and determine thesegmentation prediction loss term based on the predicted probability.

According to an implementation of another aspect, an apparatus fordetecting damage from a picture is provided. The apparatus can bedeployed in any device, platform, or device cluster with computing andprocessing capabilities. FIG. 9 is a schematic block diagramillustrating a damage detection apparatus, according to animplementation. As shown in FIG. 9, the detection apparatus 900includes: a model acquisition unit 91, configured to obtain a weaksegmentation damage detection model trained by using the apparatus inFIG. 8; a model input unit 92, configured to input a to-be-examinedpicture to the weak segmentation damage detection model, where the weaksegmentation damage detection model includes a box prediction branch anda segmentation prediction branch, the box prediction branch outputs boxprediction data used to indicate at least one damage prediction box, andthe segmentation prediction branch outputs segmentation prediction dataobtained after a segmentation type of each pixel in the to-be-examinedpicture is predicted; and a result determining unit 93, configured todetermine a damage detection result for the to-be-examined picture basedon the box prediction data and the segmentation prediction data.

In an implementation, the result determining unit 93 is configured to:determine that the damage detection result is that the to-be-examinedpicture includes no damaged object when the box prediction data does notindicate a damage prediction box or the segmentation prediction datadoes not indicate a damaged object region, where the damaged objectregion is a connected region whose area is greater than a specificthreshold and that is formed by a set of pixels whose predictedsegmentation types are the same type.

In an implementation, the box prediction data indicates at least onedamage prediction box, and the segmentation prediction data indicates atleast one damaged object region. In this case, the result determiningunit 93 is configured to determine the damage detection result for theto-be-examined picture based on the at least one damage prediction boxand the at least one damaged object region.

Specifically, in an implementation, the result determining unit 93 isconfigured to: use a union set of a region set corresponding to the atleast one damage prediction box and a region set corresponding to the atleast one damaged object region as the damage detection result.

In an implementation, the at least one damage prediction box includes afirst damage prediction box, and the result determining unit 93 isconfigured to remove the first damage prediction box from the damagedetection result if intersection-over-union between the first damageprediction box and each damaged object region is less than apredetermined threshold.

In another implementation, the result determining unit 93 can be furtherconfigured to remove the first damage prediction box from the damagedetection result if a proportion of an intersection area between thefirst damage prediction box and each damaged object region to a box areaof the first damage prediction box is less than a predeterminedthreshold.

In an implementation, the at least one damage prediction box includes afirst damage prediction box, the box prediction data further includes afirst damage type predicted for the first damage prediction box, the atleast one damaged object region includes a first damaged object region,and a pixel in the first damaged object region corresponds to a firstsegmentation type. In this case, the result determining unit 93 can beconfigured to: determine the first damage prediction box as an abnormalprediction box or determine the first damaged object region as anabnormal region if intersection-over-union between the first damageprediction box and the first damaged object region is greater than apredetermined threshold, but the first damage type and the firstsegmentation type are not correlated.

By using the apparatuses in FIG. 8 and FIG. 9, the weak segmentationdamage detection model is trained based on the weak mark data, and adamaged object is recognized from a picture by using the model.

According to an implementation of another aspect, a computer readablestorage medium is provided. The computer readable storage medium storesa computer program, and when the computer program is executed in acomputer, the computer is enabled to perform the method described withreference to FIG. 2 and FIG. 6.

According to an implementation of still another aspect, a computingdevice is further provided, and includes a memory and a processor. Thememory stores executable code, and when the processor executes theexecutable code, the method described with reference to FIG. 2 and FIG.6 is implemented.

A person skilled in the art should be aware that in the previous one ormore examples, functions described in the present disclosure can beimplemented by hardware, software, firmware, or any combination thereof.When the functions are implemented by software, the functions can bestored in a computer readable medium or transmitted as one or moreinstructions or code in a computer readable medium.

The objectives, technical solutions, and beneficial effects of thepresent disclosure are further described in detail in the previouslydescribed specific implementations. It should be understood that theprevious descriptions are merely specific implementations of the presentdisclosure, and are not intended to limit the protection scope of thepresent disclosure. Any modification, equivalent replacement, orimprovement made based on the technical solutions of the presentdisclosure shall fall within the protection scope of the presentdisclosure.

1.-21. (canceled)
 22. A computer-implemented method for damagedetection, comprising: obtaining, by one or more computing devices, asample image to be examined; inputting the sample picture into a weaksegmentation damage detection model, wherein the weak segmentationdamage detection model comprises a region prediction branch and asegmentation prediction branch, wherein the region prediction branchoutputs region prediction data indicating a damage prediction region inthe sample image, and wherein the segmentation prediction branch outputssegmentation prediction data comprising a predicted segmentation type ofeach pixel of a plurality of pixels in the sample image; anddetermining, based on the region prediction data and the segmentationprediction data, whether damage is detected in the sample image.
 23. Thecomputer-implemented method of claim 22, wherein determining whetherdamage is detected in the sample image comprises: determining that noportion of the plurality of pixels have a matching predictedsegmentation type and form a connected region having an area greaterthan a specified threshold area; and based on determining that noportion of the plurality of pixels have a matching predictedsegmentation type and form a connected region having an area greaterthan the specified threshold area, determining that damage is notdetected in the sample image.
 24. The computer-implemented method ofclaim 22, wherein determining whether damage is detected in the sampleimage comprises: determining that at least a portion of the plurality ofpixels have a matching segmentation type and form a connected regionhaving an area greater than a specified threshold area, the at least theportion of the plurality of pixels forming a damaged object region; anddetermining, based on the damage prediction region and the damagedobject region, whether damage is detected in the sample image.
 25. Thecomputer-implemented method of claim 24, wherein determining whetherdamage is detected in the sample image comprises: forming a union regionof the damage prediction region and the damaged object region; anddetermining, based on the union region, whether damage is detected inthe sample image.
 26. The computer-implemented method of claim 24,wherein determining whether damage is detected in the sample imagecomprises: determining that an intersection-over-union of the damageprediction region and the damaged object region is less than apredetermined threshold; and based on determining that theintersection-over-union is less than the predetermined threshold,removing the damage prediction region from consideration whendetermining whether damage is detected in the sample image.
 27. Thecomputer-implemented method of claim 24, wherein the damage predictionregion corresponds to a damage prediction type, and wherein determiningwhether damage is detected in the sample image comprises: determiningthat an intersection-over-union of the damage prediction region and thedamaged object region is greater than a predetermined threshold; anddetermining whether the damage prediction type correlates with thematching segmentation type of the damaged object region.
 28. Thecomputer-implemented method of claim 24, wherein the damage predictionregion corresponds to a damage prediction type, and wherein determiningwhether damage is detected in the sample image comprises: determiningthat the damage prediction type does not correlate with the matchingsegmentation type of the damaged object region; and based on determiningthat the damage prediction type does not correlate with the matchingsegmentation type of the damaged object region, determining that atleast one of the damage prediction region and the damaged object regionis abnormal.
 29. A non-transitory, computer-readable medium storing oneor more instructions executable by a computer system to performoperations for damage detection, the operations comprising: obtaining,by one or more computing devices, a sample image to be examined;inputting the sample picture into a weak segmentation damage detectionmodel, wherein the weak segmentation damage detection model comprises aregion prediction branch and a segmentation prediction branch, whereinthe region prediction branch outputs region prediction data indicating adamage prediction region in the sample image, and wherein thesegmentation prediction branch outputs segmentation prediction datacomprising a predicted segmentation type of each pixel of a plurality ofpixels in the sample image; and determining, based on the regionprediction data and the segmentation prediction data, whether damage isdetected in the sample image.
 30. The computer-readable medium of claim29, wherein determining whether damage is detected in the sample imagecomprises: determining that no portion of the plurality of pixels have amatching predicted segmentation type and form a connected region havingan area greater than a specified threshold area; and based ondetermining that no portion of the plurality of pixels have a matchingpredicted segmentation type and form a connected region having an areagreater than the specified threshold area, determining that damage isnot detected in the sample image.
 31. The computer-readable medium ofclaim 29, wherein determining whether damage is detected in the sampleimage comprises: determining that at least a portion of the plurality ofpixels have a matching segmentation type and form a connected regionhaving an area greater than a specified threshold area, the at least theportion of the plurality of pixels forming a damaged object region; anddetermining, based on the damage prediction region and the damagedobject region, whether damage is detected in the sample image.
 32. Thecomputer-readable medium of claim 31, wherein determining whether damageis detected in the sample image comprises: forming a union region of thedamage prediction region and the damaged object region; and determining,based on the union region, whether damage is detected in the sampleimage.
 33. The computer-readable medium of claim 31, wherein determiningwhether damage is detected in the sample image comprises: determiningthat an intersection-over-union of the damage prediction region and thedamaged object region is less than a predetermined threshold; and basedon determining that the intersection-over-union is less than thepredetermined threshold, removing the damage prediction region fromconsideration when determining whether damage is detected in the sampleimage.
 34. The computer-readable medium of claim 31, wherein the damageprediction region corresponds to a damage prediction type, and whereindetermining whether damage is detected in the sample image comprises:determining that an intersection-over-union of the damage predictionregion and the damaged object region is greater than a predeterminedthreshold; and determining whether the damage prediction type correlateswith the matching segmentation type of the damaged object region. 35.The computer-readable medium of claim 31, wherein the damage predictionregion corresponds to a damage prediction type, and wherein determiningwhether damage is detected in the sample image comprises: determiningthat the damage prediction type does not correlate with the matchingsegmentation type of the damaged object region; and based on determiningthat the damage prediction type does not correlate with the matchingsegmentation type of the damaged object region, determining that atleast one of the damage prediction region and the damaged object regionis abnormal.
 36. A computer-implemented system, comprising: one or morecomputers; and one or more computer memory devices interoperably coupledwith the one or more computers and having tangible, non-transitory,machine-readable media storing one or more instructions that, whenexecuted by the one or more computers, perform one or more operationsfor damage detection, the operations comprising: obtaining, by one ormore computing devices, a sample image to be examined; inputting thesample picture into a weak segmentation damage detection model, whereinthe weak segmentation damage detection model comprises a regionprediction branch and a segmentation prediction branch, wherein theregion prediction branch outputs region prediction data indicating adamage prediction region in the sample image, and wherein thesegmentation prediction branch outputs segmentation prediction datacomprising a predicted segmentation type of each pixel of a plurality ofpixels in the sample image; and determining, based on the regionprediction data and the segmentation prediction data, whether damage isdetected in the sample image.
 37. The computer-implemented system ofclaim 36, wherein determining whether damage is detected in the sampleimage comprises: determining that no portion of the plurality of pixelshave a matching predicted segmentation type and form a connected regionhaving an area greater than a specified threshold area; and based ondetermining that no portion of the plurality of pixels have a matchingpredicted segmentation type and form a connected region having an areagreater than the specified threshold area, determining that damage isnot detected in the sample image.
 38. The computer-implemented system ofclaim 36, wherein determining whether damage is detected in the sampleimage comprises: determining that at least a portion of the plurality ofpixels have a matching segmentation type and form a connected regionhaving an area greater than a specified threshold area, the at least theportion of the plurality of pixels forming a damaged object region; anddetermining, based on the damage prediction region and the damagedobject region, whether damage is detected in the sample image.
 39. Thecomputer-implemented system of claim 38, wherein determining whetherdamage is detected in the sample image comprises: forming a union regionof the damage prediction region and the damaged object region; anddetermining, based on the union region, whether damage is detected inthe sample image.
 40. The computer-implemented system of claim 38,wherein determining whether damage is detected in the sample imagecomprises: determining that an intersection-over-union of the damageprediction region and the damaged object region is less than apredetermined threshold; and based on determining that theintersection-over-union is less than the predetermined threshold,removing the damage prediction region from consideration whendetermining whether damage is detected in the sample image.
 41. Thecomputer-implemented system of claim 38, wherein the damage predictionregion corresponds to a damage prediction type, and wherein determiningwhether damage is detected in the sample image comprises: determiningthat an intersection-over-union of the damage prediction region and thedamaged object region is greater than a predetermined threshold; anddetermining whether the damage prediction type correlates with thematching segmentation type of the damaged object region.